package www.validator;

import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

import www.member.MemberDTO;
import www.member.ZipcodeDTO;

public class ZipcodeValidator implements Validator {

	@Override
	public boolean supports(Class arg0) {
		
		return ZipcodeDTO.class.isAssignableFrom(arg0);
	}

	@Override
	public void validate(Object command, Errors errors) {
		ZipcodeDTO dto = (ZipcodeDTO)command;
		System.out.println("are3:"+dto.getArea3());
		
		if(!StringUtils.hasLength(dto.getArea3())){
			errors.rejectValue("zipcode", "error.required");
		}
		

	}

}
